package com.violet.domain.dto.app;

import com.violet.annotation.verify.VPhone;
import com.violet.annotation.verify.VStringSize;
import com.violet.domain.dto.DTO;
import lombok.Data;

import java.util.List;

@Data
public class AOrderDto implements DTO {

    private AOrderAddress address;
    private List<AOrderProduct> products;

    private Double totalPrice;              // 订单总价
    private Double finalPrice;              // 订单实付金额
    private Double totalDiscountAmount;     // 订单优惠金额

    // 订单地址
    @Data
    public static class AOrderAddress implements DTO {
        @VStringSize(min = 2, max = 20)
        private String name;
        @VPhone
        private String phone;
        private String address;
    }

    // 订单商品
    @Data
    public static class AOrderProduct implements DTO {
        private String id;
        @VStringSize(min = 2, max = 20)
        private String name;
        @VStringSize(min = 4, max = 20)
        private String description;
        private Double currentPrice;
        private Double originalPrice;
        private Integer count;
        private String unit;
        private String image;
    }
}
